DefConst ( 'k_822QuotesToOptsFunc, func ( addrTxt )
	begin
	// LRT - 97/04/22 1:49 AM
	// Function to replace commas and quotes in received
	// RFC-822 header text with special option characters
	// which we can use to put them back later

	local s := Clone ( addrTxt );
	local inQuote;
	local inParen;
	local int i;
	for i := 0 to StrLen(s) - 1 do
		begin
		if not inParen and s[i] = $" then
			begin
			if inQuote then inQuote := nil
			else inQuote := true;
			end;
		else if not inQuote and s[i] = $( then
			inParen := true;
		else if inParen and s[i] = $) then
			inParen := nil;
		else if inQuote or inParen then
			begin
			if s[i] = $, then s[i] := $\E7; //$\B8;	// shift-opt-z
			else if s[i] = $\\ and s[i+1] = $" then
				begin
				//s[i] := $\20;
				s[i+1] := $\A8;
				end;
			end;
		end;
	// will be done in "k_AddrFrom822Func"
	//StrReplace ( s, "\u005C00A8", "\u005C0022", nil );
	s;
	end );
